using Microsoft.AspNetCore.Mvc;
using ZR.Admin.WebApi.Filters;
using ZR.Model;
using ZR.Model.System;
using ZR.Model.System.Dto;
using ZR.ServiceCore.Services.IService;

namespace ZR.Admin.WebApi.Controllers.System
{
    /// <summary>
    /// B_CDWL_PPI_LR管理
    /// </summary>
    [Verify]
    [Route("system/b_cdwl_ppi_lr")]
    [ApiExplorerSettings(GroupName = "sys")]
    public class B_CDWL_PPI_LRController : BaseController
    {
        /// <summary>
        /// B_CDWL_PPI_LR服务
        /// </summary>
        private readonly IB_CDWL_PPI_LRService _b_cdwl_ppi_lrService;

        public B_CDWL_PPI_LRController(IB_CDWL_PPI_LRService b_cdwl_ppi_lrService)
        {
            _b_cdwl_ppi_lrService = b_cdwl_ppi_lrService;
        }

        /// <summary>
        /// 查询B_CDWL_PPI_LR列表
        /// </summary>
        /// <param name="request">查询参数</param>
        /// <returns></returns>
        [HttpPost("list")]
        public IActionResult List([FromBody] B_CDWL_PPI_LRListRequest request)
        {
            var query = new B_CDWL_PPI_LRQueryDto
            {
                Id = request.Id,
                Timestamp = request.Timestamp,
                Azimuth = request.Azimuth,
                Elevation = request.Elevation,
                Distance = request.Distance,
                RadialSpeed = request.RadialSpeed,
                SpectrumWidth = request.SpectrumWidth,
                Snr = request.Snr,
                Amplitude = request.Amplitude,
                SourceTable = request.SourceTable,
                TimeParam = request.TimeParam,
                UseLike = false
            };
            var pager = new PagerInfo
            {
                PageNum = request.PageNum,
                PageSize = request.PageSize
            };
            var list = _b_cdwl_ppi_lrService.SelectB_CDWL_PPI_LRList(query, pager);
            return SUCCESS(list);
        }

        /// <summary>
        /// 获取所有B_CDWL_PPI_LR表名
        /// </summary>
        /// <returns></returns>
        [HttpGet("tables")]
        public IActionResult GetTables()
        {
            var tables = _b_cdwl_ppi_lrService.GetAllB_CDWL_PPI_LRTableNames();
            return SUCCESS(tables);
        }

        /// <summary>
        /// 根据时间参数获取B_CDWL_PPI_LR表名
        /// </summary>
        /// <param name="timeParam">时间参数</param>
        /// <returns></returns>
        [HttpGet("tables/{timeParam}")]
        public IActionResult GetTablesByTimeParam(string timeParam)
        {
            var tables = _b_cdwl_ppi_lrService.GetB_CDWL_PPI_LRTableNames(timeParam);
            return SUCCESS(tables);
        }
    }
}



